﻿#region

#endregion

namespace ComicsDownloader.Engine
{
    public class Picture
    {
        public Picture(string title, string id, int no, Cartoon cartoon)
        {
            Title = title;
            Id = id;
            No = no;

            // http://stoo.asiae.co.kr/cartoon/ctview.htm?sc2=ing&sc3=1&id={0}&pg={1}&tpg={2}
            Url = string.Format(cartoon.PictureUrl, Id, No - 1, No);

            string cartoonName = Utility.ToValidFileName(cartoon.Name);
            string fixedTitle = Utility.ToValidFileName(title);
            LocalPath = cartoonName + "\\" + fixedTitle + "_" + no + cartoon.Extension;
        }

        public string Title { get; private set; }

        public string Id { get; private set; }

        public bool Downloaded { get; set; }

        public int No { get; private set; }

        public string Url { get; private set; }

        public string LocalPath { get; private set; }

        public string TitleWithNo
        {
            get { return Title + "_" + No; }
        }
    }
}